log using "\\file\UsersW$\wrr15\Home\My Documents\My Files\D'HAULTFOEUILLE Files\DATAVERSE FILES\TABLE3.smcl", replace

set matsize 10000

use "\\file\UsersW$\wrr15\Home\My Documents\My Files\D'HAULTFOEUILLE Files\DATAVERSE FILES\GentzkowData.dta", clear

// FD estimate (key var = changedailies)
areg changeprestout changedailies if mainsample, absorb(styr) cluster(cnty90)
scalar betafd=_b[changedailies]

// FE estimate (key var = numdailies)
areg prestout numdailies i.year styr1-styr666, absorb(cnty90) cluster(cnty90)
di _b[numdailies], _se[numdailies], e(N)

// This section uses bootstrapping to test for differences between the FD and FE estimates
set seed 1
scalar diff=betafd-_b[numdailies]
matrix A=0
qui{
forvalue i=1/100{
preserve
bsample, cluster(cnty90)
areg changeprestout changedailies if mainsample, absorb(styr)
scalar beta2=_b[changedailies]
areg prestout i.year numdailies styr1-styr666, absorb(cnty90)
matrix A=A\beta2-_b[numdailies]
restore
}
}
drop _all
svmat A
drop if _n==1
sum A1
di diff/r(sd)

log close
